# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=packetfu
pkgname=ruby-${_gemname}
pkgver=1.1.13
pkgrel=5
pkgdesc='Library for reading and writing packets to an interface or to a libpcap-formatted file'
url='https://github.com/packetfu/packetfu'
arch=('any')
license=('BSD')
depends=('ruby' 'ruby-network_interface' 'ruby-pcaprub')
makedepends=('ruby-rake' 'ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/packetfu/packetfu/archive/version-${pkgver}.tar.gz)
sha256sums=('323add3c94b869c48c9f20ecacc0d176c9a0d1a47f606ebaa15105f5c9a9d828')
sha512sums=('2e8f2e05b15cf5e9007384ff55dfa6dad9a8f9d32f86b8d05dd4df930f72bd9fa80a84a5f465c936fca5615f87cd6129a0edad0863ef4eca15c5d970390d62a0')

prepare() {
  cd ${_gemname}-version-${pkgver}
  sed 's|git ls-files|find|' -i ${_gemname}.gemspec
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-version-${pkgver}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-version-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}/${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 examples/* -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
}

# vim: ts=2 sw=2 et:
